/**
 * 
 */
package com.net.service.chart;

import org.jfree.chart.JFreeChart;
import org.jfree.data.category.DefaultCategoryDataset;

import com.net.util.chart.FoldLineTools;

/**
 *
 * @author fengcheng
 * @date 2018年6月25日 下午7:18:50
 */
public class FoldLineServiceImpl implements FoldLineService {

	/* (non-Javadoc)
	 * @see com.net.service.chart.FoldLineService#createFoldLineTools()
	 */
	@Override
	public JFreeChart createFoldLineTools() {
		  // TODO Auto-generated method stub
	    //获取折线图数据源
	    DefaultCategoryDataset dataset=getDataSet();
	    //从折线图工具类中获取创建完成的折线图
	    JFreeChart chart=FoldLineTools.createFoldLine(dataset);

	    return chart;
	}
	/**
	 * 为折线图创建数据
	 * @return
	 */
	public static DefaultCategoryDataset getDataSet(){
	    //创建数据集
	    DefaultCategoryDataset dataset=new DefaultCategoryDataset();
	    //添加数据
	    dataset.addValue(15636.36, "张三", "一月");
	    dataset.addValue(10001.36, "张三", "二月");
	    dataset.addValue(8856.20, "张三", "三月");
	    dataset.addValue(5964.26, "张三", "四月");
	    dataset.addValue(12365.23, "李四", "一月");
	    dataset.addValue(20056.12, "李四", "二月");
	    dataset.addValue(7896.36, "李四", "三月");
	    dataset.addValue(23005.45, "李四", "四月");
	    return dataset;

	}

}
